﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TopTen.Entities;
using TopTen.Services;

namespace TopTen.UI.Controllers
{
	public class WidgetController : CoolCode.Web.Mvc.ControllerBase
	{
		private IWidgetService _WidgetService;
		public IWidgetService WidgetService
		{
			get
			{
				if (_WidgetService == null)
				{
					_WidgetService = Digger.Dig<IWidgetService>();
				}
				return _WidgetService;
			}
		}

		public WidgetController()
		{
			 
		}

		//public ActionResult Index()
		//{
		//    var model = this.WidgetService.List();
		//    return View(model);
		//}

		//public ActionResult Edit(int? id)
		//{
		//    Widget model = new Widget();
		//    if (id.HasValue)
		//    {
		//        model = this.WidgetService.Get(id.Value);
		//    }
		//    return View(model);
		//}

		//[HttpPost]
		//public ActionResult Edit()
		//{
		//    Widget model = new Widget();
		//    TryUpdateModel(model);
		//    this.WidgetService.Save(model);
		//    return RedirectToAction("Detail", new { id = model.ID });
		//}

		//public ActionResult Detail(int id)
		//{
		//    Widget model  = this.WidgetService.Get(id);
		//    if (model == null)
		//    {
		//        return RedirectToAction("Error");
		//    }
		//    return View(model);
		//}
	}
}
